var app = getApp()
Page({
  data: {
    motto: 'Hello World',
    userInfo: {},
    classdetail: {
      "data": {
        "data": {
          "classEvaluate": 0,
          "classEntryState": 0,
          "userVerifyState": 0,
          "endTime": 1488211200000,
          "score": 0,
          "modifyUserId": "admin",
          "modifyTime": 1487128745000,
          "classState": 2,
          "planStuNum": 0,
          "entryStuNum": 3,
          "classId": "d1e37f13-f299-11e6-a115-507b9dbfbcab",
          "modifyUserName": "admin",
          "nonAuditStuNum": 0,
          "beginTime": 1486915200000,
          "classType": 1,
          "classInfoName": "2017班级测试"
        },
        "propertyNamingStrategy": {
          "id": "classId",
          "title": "classInfoName",
          "pageNum": "pageSize"
        }
      },
      "message": "",
      "success": true
    },
    InstanceItem:{
    "data": {
      "resultList": [
        {
          "itemType": 1,
          "operatorId": "admin",
          "operator": "admin",
          "instanceId": "5e32e81c-02fe-11e7-b340-507b9dbfbcab",
          "itemState": 1,
          "beginDate": -62074886400000,
          "endDate": -62072899200000,
          "answerShowWay": 1,
          "resultShowWay": 1,
          "itemOrder": 1,
          "saveTemplate": 2,
          "itemWay": 1,
          "itemName": "测试学前阶段",
          "answerWay": 1,
          "studyMoment": 1,
          "personItemState": 1,
          "instanceItemId": "4d4509da-0304-11e7-b340-507b9dbfbcab"
        },
        {
          "itemType": 1,
          "operatorId": "admin",
          "operator": "admin",
          "instanceId": "5e32e81c-02fe-11e7-b340-507b9dbfbcab",
          "itemState": 1,
          "beginDate": -62074800000000,
          "endDate": -62072899200000,
          "answerShowWay": 1,
          "resultShowWay": 1,
          "itemOrder": 4,
          "saveTemplate": 2,
          "itemWay": 1,
          "itemName": "学后某个阶段",
          "answerWay": 1,
          "studyMoment": 2,
          "personItemState": 2,
          "instanceItemId": "67c81e8d-0304-11e7-b340-507b9dbfbcab"
        }
      ],
      "pageSize": 15,
      "currentPage": 1,
      "count": 2,
      "maxPage": 1,
      "minPage": 1,
      "firstResult": 0,
      "pagination": {
        "count": 15,
        "page": 1,
        "pages": 1,
        "size": 2
      },
      "queryInstanceId": "5e32e81c-02fe-11e7-b340-507b9dbfbcab"
    },
    "message": "",
    "success": true
  },
    classId:"",
    currentTab:0
  },
  //事件处理函数
  bindViewTap: function() {
    wx.navigateTo({
      url: '../logs/logs'
    })
  },
  onLoad: function () {
    console.log('onLoad')
    var that = this
    //调用应用实例的方法获取全局数据
    app.getUserInfo(function(userInfo){
      //更新数据
      that.setData({
        userInfo:userInfo
      })
    })
  },
  switchNav: function(e) {
    console.log(e);
    console.log(this);
    if(this.data.current === e.currentTarget.dataset.current){
      return;
    }else{
      this.setData({
        currentTab:e.currentTarget.dataset.current
      })
    }
  },
  tabChange: function(e){
    console.log(e);
    this.setData({
      currentTab:e.detail.current
    })
  }
})